---
artifact: {{ .ModuleName }}/build-nginx-static-artifact
from: {{ .Images.BASE_UBUNTU_DEV }}
shell:
  install:
  - mkdir build && cd build
  - export NGINX_VERSION=1.24.0 OPENSSL_VERSION=3.1.3 NGINX_PREFIX=/opt/nginx-static
  - git clone -b release-${NGINX_VERSION} --single-branch --depth=1 {{ $.SOURCE_REPO }}/nginx/nginx.git ./nginx
  - cd ./nginx
  - git clone -b openssl-${OPENSSL_VERSION} --single-branch --depth=1 {{ $.SOURCE_REPO }}/openssl/openssl.git
  - ./auto/configure --prefix=${NGINX_PREFIX} --with-cc-opt="-static -static-libgcc" --with-ld-opt="-static" --with-stream --with-cpu-opt=generic --with-pcre --with-mail --with-ipv6 --with-poll_module --with-select_module --with-select_module --with-poll_module --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_auth_request_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_stub_status_module --with-mail --with-mail_ssl_module --with-openssl=./openssl
  - make -j1
  - make -j1 install
  - chown -R 64535:64535 /opt/nginx-static
  - chmod 0700 /opt/nginx-static/sbin/nginx
---
image: {{ $.ModuleName }}/{{ $.ImageName }}
fromImage: common/distroless
import:
- artifact: {{ $.ModuleName }}/build-nginx-static-artifact
  add: /opt/nginx-static
  to: /opt/nginx-static
  before: setup
